{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Imports"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/usr/local/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n",
      "  from ._conv import register_converters as _register_converters\n",
      "Using TensorFlow backend.\n"
     ]
    }
   ],
   "source": [
    "from IPython.display import SVG\n",
    "from keras.utils.vis_utils import model_to_dot"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [],
   "source": [
    "import base\n",
    "from src.models import build_dueling_deep_q_model"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Architecture"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "model = build_dueling_deep_q_model()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<svg height=\"1187pt\" viewBox=\"0.00 0.00 578.46 1187.00\" width=\"578pt\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\">\n",
       "<g class=\"graph\" id=\"graph0\" transform=\"scale(1 1) rotate(0) translate(4 1183)\">\n",
       "<title>G</title>\n",
       "<polygon fill=\"#ffffff\" points=\"-4,4 -4,-1183 574.4556,-1183 574.4556,4 -4,4\" stroke=\"transparent\"/>\n",
       "<!-- 4804220016 -->\n",
       "<g class=\"node\" id=\"node1\">\n",
       "<title>4804220016</title>\n",
       "<polygon fill=\"none\" points=\"107.9448,-1134.5 107.9448,-1178.5 353.4556,-1178.5 353.4556,-1134.5 107.9448,-1134.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"147.0415\" y=\"-1152.3\">InputLayer</text>\n",
       "<polyline fill=\"none\" points=\"186.1382,-1134.5 186.1382,-1178.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"213.9727\" y=\"-1163.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"186.1382,-1156.5 241.8071,-1156.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"213.9727\" y=\"-1141.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"241.8071,-1134.5 241.8071,-1178.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"297.6313\" y=\"-1163.3\">(None, 84, 84, 4)</text>\n",
       "<polyline fill=\"none\" points=\"241.8071,-1156.5 353.4556,-1156.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"297.6313\" y=\"-1141.3\">(None, 84, 84, 4)</text>\n",
       "</g>\n",
       "<!-- 4804221360 -->\n",
       "<g class=\"node\" id=\"node2\">\n",
       "<title>4804221360</title>\n",
       "<polygon fill=\"none\" points=\"116.1069,-1053.5 116.1069,-1097.5 345.2935,-1097.5 345.2935,-1053.5 116.1069,-1053.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"147.0415\" y=\"-1071.3\">Lambda</text>\n",
       "<polyline fill=\"none\" points=\"177.9761,-1053.5 177.9761,-1097.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"205.8105\" y=\"-1082.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"177.9761,-1075.5 233.645,-1075.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"205.8105\" y=\"-1060.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"233.645,-1053.5 233.645,-1097.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"289.4692\" y=\"-1082.3\">(None, 84, 84, 4)</text>\n",
       "<polyline fill=\"none\" points=\"233.645,-1075.5 345.2935,-1075.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"289.4692\" y=\"-1060.3\">(None, 84, 84, 4)</text>\n",
       "</g>\n",
       "<!-- 4804220016&#45;&gt;4804221360 -->\n",
       "<g class=\"edge\" id=\"edge1\">\n",
       "<title>4804220016-&gt;4804221360</title>\n",
       "<path d=\"M230.7002,-1134.3664C230.7002,-1126.1516 230.7002,-1116.6579 230.7002,-1107.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"234.2003,-1107.6068 230.7002,-1097.6068 227.2003,-1107.6069 234.2003,-1107.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4804455448 -->\n",
       "<g class=\"node\" id=\"node3\">\n",
       "<title>4804455448</title>\n",
       "<polygon fill=\"none\" points=\"111.8174,-972.5 111.8174,-1016.5 349.583,-1016.5 349.583,-972.5 111.8174,-972.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"143.5415\" y=\"-990.3\">Conv2D</text>\n",
       "<polyline fill=\"none\" points=\"175.2656,-972.5 175.2656,-1016.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"203.1001\" y=\"-1001.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"175.2656,-994.5 230.9346,-994.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"203.1001\" y=\"-979.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"230.9346,-972.5 230.9346,-1016.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"290.2588\" y=\"-1001.3\">(None, 84, 84, 4)</text>\n",
       "<polyline fill=\"none\" points=\"230.9346,-994.5 349.583,-994.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"290.2588\" y=\"-979.3\">(None, 21, 21, 32)</text>\n",
       "</g>\n",
       "<!-- 4804221360&#45;&gt;4804455448 -->\n",
       "<g class=\"edge\" id=\"edge2\">\n",
       "<title>4804221360-&gt;4804455448</title>\n",
       "<path d=\"M230.7002,-1053.3664C230.7002,-1045.1516 230.7002,-1035.6579 230.7002,-1026.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"234.2003,-1026.6068 230.7002,-1016.6068 227.2003,-1026.6069 234.2003,-1026.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4804454496 -->\n",
       "<g class=\"node\" id=\"node4\">\n",
       "<title>4804454496</title>\n",
       "<polygon fill=\"none\" points=\"105.9932,-891.5 105.9932,-935.5 355.4072,-935.5 355.4072,-891.5 105.9932,-891.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"143.5415\" y=\"-909.3\">Activation</text>\n",
       "<polyline fill=\"none\" points=\"181.0898,-891.5 181.0898,-935.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"208.9243\" y=\"-920.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"181.0898,-913.5 236.7588,-913.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"208.9243\" y=\"-898.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"236.7588,-891.5 236.7588,-935.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"296.083\" y=\"-920.3\">(None, 21, 21, 32)</text>\n",
       "<polyline fill=\"none\" points=\"236.7588,-913.5 355.4072,-913.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"296.083\" y=\"-898.3\">(None, 21, 21, 32)</text>\n",
       "</g>\n",
       "<!-- 4804455448&#45;&gt;4804454496 -->\n",
       "<g class=\"edge\" id=\"edge3\">\n",
       "<title>4804455448-&gt;4804454496</title>\n",
       "<path d=\"M230.7002,-972.3664C230.7002,-964.1516 230.7002,-954.6579 230.7002,-945.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"234.2003,-945.6068 230.7002,-935.6068 227.2003,-945.6069 234.2003,-945.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4804726968 -->\n",
       "<g class=\"node\" id=\"node5\">\n",
       "<title>4804726968</title>\n",
       "<polygon fill=\"none\" points=\"111.8174,-810.5 111.8174,-854.5 349.583,-854.5 349.583,-810.5 111.8174,-810.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"143.5415\" y=\"-828.3\">Conv2D</text>\n",
       "<polyline fill=\"none\" points=\"175.2656,-810.5 175.2656,-854.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"203.1001\" y=\"-839.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"175.2656,-832.5 230.9346,-832.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"203.1001\" y=\"-817.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"230.9346,-810.5 230.9346,-854.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"290.2588\" y=\"-839.3\">(None, 21, 21, 32)</text>\n",
       "<polyline fill=\"none\" points=\"230.9346,-832.5 349.583,-832.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"290.2461\" y=\"-817.3\">(None, 11, 11, 64)</text>\n",
       "</g>\n",
       "<!-- 4804454496&#45;&gt;4804726968 -->\n",
       "<g class=\"edge\" id=\"edge4\">\n",
       "<title>4804454496-&gt;4804726968</title>\n",
       "<path d=\"M230.7002,-891.3664C230.7002,-883.1516 230.7002,-873.6579 230.7002,-864.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"234.2003,-864.6068 230.7002,-854.6068 227.2003,-864.6069 234.2003,-864.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4804727976 -->\n",
       "<g class=\"node\" id=\"node6\">\n",
       "<title>4804727976</title>\n",
       "<polygon fill=\"none\" points=\"106.5059,-729.5 106.5059,-773.5 354.8945,-773.5 354.8945,-729.5 106.5059,-729.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"144.0542\" y=\"-747.3\">Activation</text>\n",
       "<polyline fill=\"none\" points=\"181.6025,-729.5 181.6025,-773.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"209.437\" y=\"-758.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"181.6025,-751.5 237.2715,-751.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"209.437\" y=\"-736.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"237.2715,-729.5 237.2715,-773.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"296.083\" y=\"-758.3\">(None, 11, 11, 64)</text>\n",
       "<polyline fill=\"none\" points=\"237.2715,-751.5 354.8945,-751.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"296.083\" y=\"-736.3\">(None, 11, 11, 64)</text>\n",
       "</g>\n",
       "<!-- 4804726968&#45;&gt;4804727976 -->\n",
       "<g class=\"edge\" id=\"edge5\">\n",
       "<title>4804726968-&gt;4804727976</title>\n",
       "<path d=\"M230.7002,-810.3664C230.7002,-802.1516 230.7002,-792.6579 230.7002,-783.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"234.2003,-783.6068 230.7002,-773.6068 227.2003,-783.6069 234.2003,-783.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805001056 -->\n",
       "<g class=\"node\" id=\"node7\">\n",
       "<title>4805001056</title>\n",
       "<polygon fill=\"none\" points=\"112.3301,-648.5 112.3301,-692.5 349.0703,-692.5 349.0703,-648.5 112.3301,-648.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"144.0542\" y=\"-666.3\">Conv2D</text>\n",
       "<polyline fill=\"none\" points=\"175.7783,-648.5 175.7783,-692.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"203.6128\" y=\"-677.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"175.7783,-670.5 231.4473,-670.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"203.6128\" y=\"-655.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"231.4473,-648.5 231.4473,-692.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"290.2588\" y=\"-677.3\">(None, 11, 11, 64)</text>\n",
       "<polyline fill=\"none\" points=\"231.4473,-670.5 349.0703,-670.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"290.2588\" y=\"-655.3\">(None, 11, 11, 64)</text>\n",
       "</g>\n",
       "<!-- 4804727976&#45;&gt;4805001056 -->\n",
       "<g class=\"edge\" id=\"edge6\">\n",
       "<title>4804727976-&gt;4805001056</title>\n",
       "<path d=\"M230.7002,-729.3664C230.7002,-721.1516 230.7002,-711.6579 230.7002,-702.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"234.2003,-702.6068 230.7002,-692.6068 227.2003,-702.6069 234.2003,-702.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4804997808 -->\n",
       "<g class=\"node\" id=\"node8\">\n",
       "<title>4804997808</title>\n",
       "<polygon fill=\"none\" points=\"106.5059,-567.5 106.5059,-611.5 354.8945,-611.5 354.8945,-567.5 106.5059,-567.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"144.0542\" y=\"-585.3\">Activation</text>\n",
       "<polyline fill=\"none\" points=\"181.6025,-567.5 181.6025,-611.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"209.437\" y=\"-596.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"181.6025,-589.5 237.2715,-589.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"209.437\" y=\"-574.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"237.2715,-567.5 237.2715,-611.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"296.083\" y=\"-596.3\">(None, 11, 11, 64)</text>\n",
       "<polyline fill=\"none\" points=\"237.2715,-589.5 354.8945,-589.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"296.083\" y=\"-574.3\">(None, 11, 11, 64)</text>\n",
       "</g>\n",
       "<!-- 4805001056&#45;&gt;4804997808 -->\n",
       "<g class=\"edge\" id=\"edge7\">\n",
       "<title>4805001056-&gt;4804997808</title>\n",
       "<path d=\"M230.7002,-648.3664C230.7002,-640.1516 230.7002,-630.6579 230.7002,-621.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"234.2003,-621.6068 230.7002,-611.6068 227.2003,-621.6069 234.2003,-621.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805169448 -->\n",
       "<g class=\"node\" id=\"node9\">\n",
       "<title>4805169448</title>\n",
       "<polygon fill=\"none\" points=\"116.6128,-486.5 116.6128,-530.5 344.7876,-530.5 344.7876,-486.5 116.6128,-486.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"144.0542\" y=\"-504.3\">Flatten</text>\n",
       "<polyline fill=\"none\" points=\"171.4956,-486.5 171.4956,-530.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"199.3301\" y=\"-515.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"171.4956,-508.5 227.1646,-508.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"199.3301\" y=\"-493.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"227.1646,-486.5 227.1646,-530.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"285.9761\" y=\"-515.3\">(None, 11, 11, 64)</text>\n",
       "<polyline fill=\"none\" points=\"227.1646,-508.5 344.7876,-508.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"285.4888\" y=\"-493.3\">(None, 7744)</text>\n",
       "</g>\n",
       "<!-- 4804997808&#45;&gt;4805169448 -->\n",
       "<g class=\"edge\" id=\"edge8\">\n",
       "<title>4804997808-&gt;4805169448</title>\n",
       "<path d=\"M230.7002,-567.3664C230.7002,-559.1516 230.7002,-549.6579 230.7002,-540.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"234.2003,-540.6068 230.7002,-530.6068 227.2003,-540.6069 234.2003,-540.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805169280 -->\n",
       "<g class=\"node\" id=\"node10\">\n",
       "<title>4805169280</title>\n",
       "<polygon fill=\"none\" points=\"21.0483,-405.5 21.0483,-449.5 218.3521,-449.5 218.3521,-405.5 21.0483,-405.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"46.5415\" y=\"-423.3\">Dense</text>\n",
       "<polyline fill=\"none\" points=\"72.0347,-405.5 72.0347,-449.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99.8691\" y=\"-434.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"72.0347,-427.5 127.7036,-427.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"99.8691\" y=\"-412.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"127.7036,-405.5 127.7036,-449.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"173.0278\" y=\"-434.3\">(None, 7744)</text>\n",
       "<polyline fill=\"none\" points=\"127.7036,-427.5 218.3521,-427.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"173.0278\" y=\"-412.3\">(None, 512)</text>\n",
       "</g>\n",
       "<!-- 4805169448&#45;&gt;4805169280 -->\n",
       "<g class=\"edge\" id=\"edge9\">\n",
       "<title>4805169448-&gt;4805169280</title>\n",
       "<path d=\"M200.369,-486.3664C187.3987,-476.9016 172.1016,-465.7389 158.3345,-455.6926\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"160.1358,-452.6743 149.9948,-449.6068 156.0095,-458.3288 160.1358,-452.6743\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805539600 -->\n",
       "<g class=\"node\" id=\"node11\">\n",
       "<title>4805539600</title>\n",
       "<polygon fill=\"none\" points=\"244.0483,-405.5 244.0483,-449.5 441.3521,-449.5 441.3521,-405.5 244.0483,-405.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"269.5415\" y=\"-423.3\">Dense</text>\n",
       "<polyline fill=\"none\" points=\"295.0347,-405.5 295.0347,-449.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"322.8691\" y=\"-434.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"295.0347,-427.5 350.7036,-427.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"322.8691\" y=\"-412.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"350.7036,-405.5 350.7036,-449.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"396.0278\" y=\"-434.3\">(None, 7744)</text>\n",
       "<polyline fill=\"none\" points=\"350.7036,-427.5 441.3521,-427.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"396.0278\" y=\"-412.3\">(None, 512)</text>\n",
       "</g>\n",
       "<!-- 4805169448&#45;&gt;4805539600 -->\n",
       "<g class=\"edge\" id=\"edge10\">\n",
       "<title>4805169448-&gt;4805539600</title>\n",
       "<path d=\"M261.3047,-486.3664C274.3918,-476.9016 289.8267,-465.7389 303.7178,-455.6926\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"306.0808,-458.3031 312.1327,-449.6068 301.9786,-452.631 306.0808,-458.3031\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805433272 -->\n",
       "<g class=\"node\" id=\"node12\">\n",
       "<title>4805433272</title>\n",
       "<polygon fill=\"none\" points=\"8.4932,-324.5 8.4932,-368.5 222.9072,-368.5 222.9072,-324.5 8.4932,-324.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"46.0415\" y=\"-342.3\">Activation</text>\n",
       "<polyline fill=\"none\" points=\"83.5898,-324.5 83.5898,-368.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"111.4243\" y=\"-353.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"83.5898,-346.5 139.2588,-346.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"111.4243\" y=\"-331.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"139.2588,-324.5 139.2588,-368.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.083\" y=\"-353.3\">(None, 512)</text>\n",
       "<polyline fill=\"none\" points=\"139.2588,-346.5 222.9072,-346.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"181.083\" y=\"-331.3\">(None, 512)</text>\n",
       "</g>\n",
       "<!-- 4805169280&#45;&gt;4805433272 -->\n",
       "<g class=\"edge\" id=\"edge11\">\n",
       "<title>4805169280-&gt;4805433272</title>\n",
       "<path d=\"M118.6072,-405.3664C118.2015,-397.1516 117.7327,-387.6579 117.2916,-378.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"120.781,-378.422 116.7919,-368.6068 113.7895,-378.7673 120.781,-378.422\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805643904 -->\n",
       "<g class=\"node\" id=\"node13\">\n",
       "<title>4805643904</title>\n",
       "<polygon fill=\"none\" points=\"240.4932,-324.5 240.4932,-368.5 454.9072,-368.5 454.9072,-324.5 240.4932,-324.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"278.0415\" y=\"-342.3\">Activation</text>\n",
       "<polyline fill=\"none\" points=\"315.5898,-324.5 315.5898,-368.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"343.4243\" y=\"-353.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"315.5898,-346.5 371.2588,-346.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"343.4243\" y=\"-331.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"371.2588,-324.5 371.2588,-368.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"413.083\" y=\"-353.3\">(None, 512)</text>\n",
       "<polyline fill=\"none\" points=\"371.2588,-346.5 454.9072,-346.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"413.083\" y=\"-331.3\">(None, 512)</text>\n",
       "</g>\n",
       "<!-- 4805539600&#45;&gt;4805643904 -->\n",
       "<g class=\"edge\" id=\"edge12\">\n",
       "<title>4805539600-&gt;4805643904</title>\n",
       "<path d=\"M344.0665,-405.3664C344.5736,-397.1516 345.1596,-387.6579 345.711,-378.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"349.2127,-378.8035 346.3356,-368.6068 342.226,-378.3722 349.2127,-378.8035\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805431816 -->\n",
       "<g class=\"node\" id=\"node14\">\n",
       "<title>4805431816</title>\n",
       "<polygon fill=\"none\" points=\"21.5483,-243.5 21.5483,-287.5 211.8521,-287.5 211.8521,-243.5 21.5483,-243.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"47.0415\" y=\"-261.3\">Dense</text>\n",
       "<polyline fill=\"none\" points=\"72.5347,-243.5 72.5347,-287.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"100.3691\" y=\"-272.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"72.5347,-265.5 128.2036,-265.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"100.3691\" y=\"-250.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"128.2036,-243.5 128.2036,-287.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"170.0278\" y=\"-272.3\">(None, 512)</text>\n",
       "<polyline fill=\"none\" points=\"128.2036,-265.5 211.8521,-265.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"170.0278\" y=\"-250.3\">(None, 1)</text>\n",
       "</g>\n",
       "<!-- 4805433272&#45;&gt;4805431816 -->\n",
       "<g class=\"edge\" id=\"edge13\">\n",
       "<title>4805433272-&gt;4805431816</title>\n",
       "<path d=\"M115.9734,-324.3664C116.0749,-316.1516 116.1921,-306.6579 116.3024,-297.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"119.8035,-297.6493 116.4273,-287.6068 112.804,-297.5628 119.8035,-297.6493\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805642224 -->\n",
       "<g class=\"node\" id=\"node15\">\n",
       "<title>4805642224</title>\n",
       "<polygon fill=\"none\" points=\"251.5483,-243.5 251.5483,-287.5 441.8521,-287.5 441.8521,-243.5 251.5483,-243.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"277.0415\" y=\"-261.3\">Dense</text>\n",
       "<polyline fill=\"none\" points=\"302.5347,-243.5 302.5347,-287.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"330.3691\" y=\"-272.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"302.5347,-265.5 358.2036,-265.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"330.3691\" y=\"-250.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"358.2036,-243.5 358.2036,-287.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"400.0278\" y=\"-272.3\">(None, 512)</text>\n",
       "<polyline fill=\"none\" points=\"358.2036,-265.5 441.8521,-265.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"400.0278\" y=\"-250.3\">(None, 6)</text>\n",
       "</g>\n",
       "<!-- 4805643904&#45;&gt;4805642224 -->\n",
       "<g class=\"edge\" id=\"edge14\">\n",
       "<title>4805643904-&gt;4805642224</title>\n",
       "<path d=\"M347.4269,-324.3664C347.3255,-316.1516 347.2083,-306.6579 347.098,-297.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"350.5964,-297.5628 346.9731,-287.6068 343.5969,-297.6493 350.5964,-297.5628\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805843488 -->\n",
       "<g class=\"node\" id=\"node16\">\n",
       "<title>4805843488</title>\n",
       "<polygon fill=\"none\" points=\"0,-162.5 0,-206.5 235.4004,-206.5 235.4004,-162.5 0,-162.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"20.0552\" y=\"-180.3\">Add</text>\n",
       "<polyline fill=\"none\" points=\"40.1104,-162.5 40.1104,-206.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"67.9448\" y=\"-191.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"40.1104,-184.5 95.7793,-184.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"67.9448\" y=\"-169.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"95.7793,-162.5 95.7793,-206.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"165.5898\" y=\"-191.3\">[(None, 1), (None, 6)]</text>\n",
       "<polyline fill=\"none\" points=\"95.7793,-184.5 235.4004,-184.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"165.1035\" y=\"-169.3\">(None, 6)</text>\n",
       "</g>\n",
       "<!-- 4805431816&#45;&gt;4805843488 -->\n",
       "<g class=\"edge\" id=\"edge15\">\n",
       "<title>4805431816-&gt;4805843488</title>\n",
       "<path d=\"M116.9734,-243.3664C117.0749,-235.1516 117.1921,-225.6579 117.3024,-216.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"120.8035,-216.6493 117.4273,-206.6068 113.804,-216.5628 120.8035,-216.6493\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805642224&#45;&gt;4805843488 -->\n",
       "<g class=\"edge\" id=\"edge16\">\n",
       "<title>4805642224-&gt;4805843488</title>\n",
       "<path d=\"M284.4274,-243.4734C255.1474,-233.1167 220.0684,-220.7088 189.6571,-209.952\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"190.5553,-206.5573 179.9606,-206.5222 188.221,-213.1566 190.5553,-206.5573\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805842816 -->\n",
       "<g class=\"node\" id=\"node17\">\n",
       "<title>4805842816</title>\n",
       "<polygon fill=\"none\" points=\"253.1069,-162.5 253.1069,-206.5 440.2935,-206.5 440.2935,-162.5 253.1069,-162.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"284.0415\" y=\"-180.3\">Lambda</text>\n",
       "<polyline fill=\"none\" points=\"314.9761,-162.5 314.9761,-206.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"342.8105\" y=\"-191.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"314.9761,-184.5 370.645,-184.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"342.8105\" y=\"-169.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"370.645,-162.5 370.645,-206.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"405.4692\" y=\"-191.3\">(None, 6)</text>\n",
       "<polyline fill=\"none\" points=\"370.645,-184.5 440.2935,-184.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"405.3071\" y=\"-169.3\">(1, 1)</text>\n",
       "</g>\n",
       "<!-- 4805642224&#45;&gt;4805842816 -->\n",
       "<g class=\"edge\" id=\"edge17\">\n",
       "<title>4805642224-&gt;4805842816</title>\n",
       "<path d=\"M346.7002,-243.3664C346.7002,-235.1516 346.7002,-225.6579 346.7002,-216.7252\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"350.2003,-216.6068 346.7002,-206.6068 343.2003,-216.6069 350.2003,-216.6068\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805841304 -->\n",
       "<g class=\"node\" id=\"node18\">\n",
       "<title>4805841304</title>\n",
       "<polygon fill=\"none\" points=\"114.3896,-81.5 114.3896,-125.5 349.0107,-125.5 349.0107,-81.5 114.3896,-81.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"145.7173\" y=\"-99.3\">Subtract</text>\n",
       "<polyline fill=\"none\" points=\"177.0449,-81.5 177.0449,-125.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"204.8794\" y=\"-110.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"177.0449,-103.5 232.7139,-103.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"204.8794\" y=\"-88.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"232.7139,-81.5 232.7139,-125.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"290.8623\" y=\"-110.3\">[(None, 6), (1, 1)]</text>\n",
       "<polyline fill=\"none\" points=\"232.7139,-103.5 349.0107,-103.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"290.376\" y=\"-88.3\">(1, 6)</text>\n",
       "</g>\n",
       "<!-- 4805843488&#45;&gt;4805841304 -->\n",
       "<g class=\"edge\" id=\"edge18\">\n",
       "<title>4805843488-&gt;4805841304</title>\n",
       "<path d=\"M148.8512,-162.3664C162.2977,-152.8123 178.1791,-141.5281 192.4214,-131.4086\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"194.4623,-134.2521 200.5869,-125.6068 190.4078,-128.5458 194.4623,-134.2521\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805842816&#45;&gt;4805841304 -->\n",
       "<g class=\"edge\" id=\"edge19\">\n",
       "<title>4805842816-&gt;4805841304</title>\n",
       "<path d=\"M315.2759,-162.3664C301.7115,-152.8123 285.6907,-141.5281 271.3235,-131.4086\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"273.2775,-128.5039 263.0865,-125.6068 269.2466,-134.2268 273.2775,-128.5039\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4806044136 -->\n",
       "<g class=\"node\" id=\"node20\">\n",
       "<title>4806044136</title>\n",
       "<polygon fill=\"none\" points=\"231.2139,-.5 231.2139,-44.5 468.1865,-44.5 468.1865,-.5 231.2139,-.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"263.7173\" y=\"-18.3\">Multiply</text>\n",
       "<polyline fill=\"none\" points=\"296.2207,-.5 296.2207,-44.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"324.0552\" y=\"-29.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"296.2207,-22.5 351.8896,-22.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"324.0552\" y=\"-7.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"351.8896,-.5 351.8896,-44.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"410.0381\" y=\"-29.3\">[(1, 6), (None, 6)]</text>\n",
       "<polyline fill=\"none\" points=\"351.8896,-22.5 468.1865,-22.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"409.5518\" y=\"-7.3\">(1, 6)</text>\n",
       "</g>\n",
       "<!-- 4805841304&#45;&gt;4806044136 -->\n",
       "<g class=\"edge\" id=\"edge20\">\n",
       "<title>4805841304-&gt;4806044136</title>\n",
       "<path d=\"M263.9442,-81.3664C277.8625,-71.8123 294.3012,-60.5281 309.0432,-50.4086\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"311.2314,-53.1518 317.4952,-44.6068 307.2699,-47.3807 311.2314,-53.1518\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "<!-- 4805952456 -->\n",
       "<g class=\"node\" id=\"node19\">\n",
       "<title>4805952456</title>\n",
       "<polygon fill=\"none\" points=\"366.9448,-81.5 366.9448,-125.5 570.4556,-125.5 570.4556,-81.5 366.9448,-81.5\" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"406.0415\" y=\"-99.3\">InputLayer</text>\n",
       "<polyline fill=\"none\" points=\"445.1382,-81.5 445.1382,-125.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"472.9727\" y=\"-110.3\">input:</text>\n",
       "<polyline fill=\"none\" points=\"445.1382,-103.5 500.8071,-103.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"472.9727\" y=\"-88.3\">output:</text>\n",
       "<polyline fill=\"none\" points=\"500.8071,-81.5 500.8071,-125.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"535.6313\" y=\"-110.3\">(None, 6)</text>\n",
       "<polyline fill=\"none\" points=\"500.8071,-103.5 570.4556,-103.5 \" stroke=\"#000000\"/>\n",
       "<text fill=\"#000000\" font-family=\"Times,serif\" font-size=\"14.00\" text-anchor=\"middle\" x=\"535.6313\" y=\"-88.3\">(None, 6)</text>\n",
       "</g>\n",
       "<!-- 4805952456&#45;&gt;4806044136 -->\n",
       "<g class=\"edge\" id=\"edge21\">\n",
       "<title>4805952456-&gt;4806044136</title>\n",
       "<path d=\"M436.1829,-81.3664C422.1466,-71.8123 405.5687,-60.5281 390.7017,-50.4086\" fill=\"none\" stroke=\"#000000\"/>\n",
       "<polygon fill=\"#000000\" points=\"392.4143,-47.3404 382.1782,-44.6068 388.4754,-53.1271 392.4143,-47.3404\" stroke=\"#000000\"/>\n",
       "</g>\n",
       "</g>\n",
       "</svg>"
      ],
      "text/plain": [
       "<IPython.core.display.SVG object>"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "SVG(model_to_dot(model, show_shapes=True, show_layer_names=False).create(prog='dot', format='svg'))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Summary"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "cnn (InputLayer)                (None, 84, 84, 4)    0                                            \n",
      "__________________________________________________________________________________________________\n",
      "lambda_1 (Lambda)               (None, 84, 84, 4)    0           cnn[0][0]                        \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_1 (Conv2D)               (None, 21, 21, 32)   8224        lambda_1[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "activation_1 (Activation)       (None, 21, 21, 32)   0           conv2d_1[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_2 (Conv2D)               (None, 11, 11, 64)   32832       activation_1[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "activation_2 (Activation)       (None, 11, 11, 64)   0           conv2d_2[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_3 (Conv2D)               (None, 11, 11, 64)   36928       activation_2[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "activation_3 (Activation)       (None, 11, 11, 64)   0           conv2d_3[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "flatten_1 (Flatten)             (None, 7744)         0           activation_3[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "dense_1 (Dense)                 (None, 512)          3965440     flatten_1[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "dense_3 (Dense)                 (None, 512)          3965440     flatten_1[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "activation_4 (Activation)       (None, 512)          0           dense_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "activation_5 (Activation)       (None, 512)          0           dense_3[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense_2 (Dense)                 (None, 1)            513         activation_4[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "dense_4 (Dense)                 (None, 6)            3078        activation_5[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "add_1 (Add)                     (None, 6)            0           dense_2[0][0]                    \n",
      "                                                                 dense_4[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "lambda_2 (Lambda)               (1, 1)               0           dense_4[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "subtract_1 (Subtract)           (1, 6)               0           add_1[0][0]                      \n",
      "                                                                 lambda_2[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "mask (InputLayer)               (None, 6)            0                                            \n",
      "__________________________________________________________________________________________________\n",
      "multiply_1 (Multiply)           (1, 6)               0           subtract_1[0][0]                 \n",
      "                                                                 mask[0][0]                       \n",
      "==================================================================================================\n",
      "Total params: 8,012,455\n",
      "Trainable params: 8,012,455\n",
      "Non-trainable params: 0\n",
      "__________________________________________________________________________________________________\n"
     ]
    }
   ],
   "source": [
    "model.summary()"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    " "
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
